<template>
<div>
  <h1>欢迎来到{{name}}的商店</h1>
  <router-link :to="{path:'/ssupdet'}">管理页面</router-link>
  <table>
    <tr>
      <td>名称</td>
      <td>价格</td>
      <td>展示</td>
    </tr>
    <tr v-for="i in list">
      <td>{{i.name}}</td>
      <td>{{i.price}}</td>
      <td>
        <img :src="'http://127.0.0.1:8000'+i.pic" alt="" width="200px">
      </td>
    </tr>
  </table>
  <button v-for="i in num" @click="show_goods(i)">{{i}}</button>

</div>
</template>

<script>
export default {
  name: "sszhuye",
  data(){
    return{
      name:localStorage.getItem('name'),
      user:localStorage.getItem('userid'),
      list:[],
      num:""
    }
  },
  methods:{
    show_goods(i){
      this.$axios.get('users/ShangDian_API/?cpage='+i+'&user='+this.user)
      .then(i=>{
        this.list = i.data.list
        this.num = i.data.num

      })
    },

  },
  mounted() {
    this.show_goods(1)
  }
}
</script>

<style scoped>

</style>
